package com.ayoka.parenting.ui.coach.invitedrecord;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;

import com.ayoka.parenting.R;
import com.ayoka.parenting.adapter.InvitedRecordAdapter;
import com.ayoka.parenting.bean.BasicUserInfoBean;
import com.ayoka.parenting.databinding.ActivityBaseRecyclerviewBinding;
import com.ayoka.parenting.mvp.MVPBaseRecyclerViewActivity;
import com.jincp.common.brvah.BaseQuickAdapter;
import com.jincp.common.brvah.BaseViewHolder;
import com.jincp.common.model.ToolBarOptions;

import java.util.List;

/**
 * @ProjectName: MVPPlugin.
 * @ClassName: InvitedRecordActivity.
 * @Description: .
 * @Author: jincp.
 * @CreateDate: 2019/10/10 18:17.
 */
public class InvitedRecordActivity extends MVPBaseRecyclerViewActivity<BasicUserInfoBean, ActivityBaseRecyclerviewBinding, InvitedRecordContract.View, InvitedRecordPresenter> implements InvitedRecordContract.View {

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, InvitedRecordActivity.class);
        activity.startActivity(intent);
    }


    @Override
    protected SwipeRefreshLayout getRefreshLayout() {
        return mDataBinding.swipeRefresh;
    }

    @Override
    protected RecyclerView getRecyclerView() {
        return mDataBinding.recyclerView;
    }

    @NonNull
    @Override
    protected BaseQuickAdapter<BasicUserInfoBean, BaseViewHolder> getAdapter() {
        return new InvitedRecordAdapter();
    }

    @Override
    protected void getData(boolean isShowWaitDialog) {
        if (mPresenter != null){
            mPresenter.getInvitedRecordListData(isShowWaitDialog, pageNo, pageSize);
        }
    }

    @Override
    protected void initData(Bundle savedInstanceState) {
        ToolBarOptions options = new ToolBarOptions(R.string.invited_record);
        setCustomToolBar(mDataBinding.customToolbar.toolbar, options);

        getData(true);
    }

    @Override
    protected InvitedRecordPresenter getPresenter() {
        return new InvitedRecordPresenter();
    }

    @Override
    public void configInvitedRecordListData(List<BasicUserInfoBean> data) {
        setLoadMoreLayout(data);
    }
}


